package com.example.zhangwei.ui.tabactivityfragment.activity;

import com.example.zhangwei.R;
import com.example.zhangwei.ui.activityfragment.fragment.OneFragment;
import com.example.zhangwei.ui.tabactivityfragment.fragment.TwoFragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;

public class TwoActivityFranment extends FragmentActivity{
	
	@Override
	protected void onCreate(Bundle arg0) {
		// TODO Auto-generated method stub
		super.onCreate(arg0);
		setContentView(R.layout.tab_activity_index_fragment);
		Fragment details = (Fragment) getSupportFragmentManager().findFragmentByTag(2222+"");
		details = new TwoFragment();
		setBody(details,2222, false);
	}
	
	public void setBody(Fragment bf,int id,boolean isback){
		if(bf==null){
			return;
		}
		FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); 
		transaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
	    transaction.replace(R.id.body, bf, id+"");
	    if (isback)
	    	transaction.addToBackStack(null);
	    transaction.commit();
	}

}
